//
//  MyButton1.m
//  EducationAdminClient
//
//  Created by kwsdzjx on 15/12/3.
//  Copyright © 2015年 周佳兴. All rights reserved.
//

#import "MyButton1.h"
#import "UIColor+CL.h"
//#import "UIStyle.h"
#import "EducationAdminClient_URL.h"
@implementation MyButton1
- (id)init
{
    self = [super init];
    if (self) {
        
        // 1、顶部图片
        self.imageView.contentMode = UIViewContentModeCenter;
        //        [self setImage:[UIImage imageNamed:@"kevin"] forState:UIControlStateNormal];
        //        [self setImage:[UIImage imageNamed:@"kevin1"] forState:UIControlStateSelected];
        
        // 2、设置文字
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self setTitle:@"按钮" forState:UIControlStateNormal];
//                [self setTitleColor:[UIColor colorWithHex:0xE95256] forState:UIControlStateNormal];
        //        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
    }
    return self;
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */
#pragma mark - 设置按钮内部图片和文字的frame
- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
    CGFloat W = contentRect.size.width;
    //    CGFloat H = contentRect.size.height;
//#ifdef Main
    
    //#ifdef Main
    if([getUIStyle() isEqualToString:STYLE0]){
        NSLog(@"主项目程序");
        return CGRectMake((W/2)-(24/2), 5, 24, 24);
    }else{
//#elif Student
        NSLog(@"学员端程序");
  
        return CGRectMake((W/2)-(25/2), 5, 25, 25);
    }
//#elif Teacher
//    NSLog(@"老师端程序");
//#else
//    NSLog(@"都不是");
//#endif
   
}
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGFloat W = contentRect.size.width;
    //    CGFloat H = contentRect.size.height;
    //    CGFloat y = contentRect.size.height;
    return CGRectMake(0, 29, W, 20);
}

@end
